import Vue from 'vue'
import VueRouter from 'vue-router'
const Home = () => import('@/views/home/Home')
const Login = () => import('@/views/login/Login')
const Personalrc = () => import('@/views/personalrc/Personalrc')
const Songrc = () => import('@/views/songrc/Songrc')
const NewMusic = () => import('@/views/newmusic/NewMusic')
const Ranking = () => import('@/views/ranking/Ranking')
const Mv = () => import('@/views/Mv/Mv')
const Singer = () => import('@/views/singer/Singer')
const MvDetail = () => import('@/views/Mv/children/mvDetail')
const SongDetail = () => import('@/views/songrc/children/songDetail')
const SingerLeader = () => import('@/views/singer/children/singerLeaderBoard')
const SingerDetail = () => import('@/views/singer/children/singerDetail')
const SearchIndex = () => import('@/views/home/searchIndex')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    name: 'home',
    redirect: '/home/personalrc',
    children: [
      {
        // 个性推荐
        path: '/home/personalrc',
        component: Personalrc,
        name: 'personalrc'
      },
      {
        // 歌单推荐
        path: '/home/songrc',
        component: Songrc,
        name: 'songrc'
      },
      {
        // 最新音乐
        path: '/home/newmusic',
        component: NewMusic,
        name: 'newmusic'
      },
      {
        // 排行榜
        path: '/home/ranking',
        component: Ranking,
        name: 'ranking'
      },
      {
        // 最新Mv
        path: '/home/newMv',
        component: Mv,
        name: 'mv'
      },
      {
        // 歌手
        path: '/home/singer',
        component: Singer,
        name: 'singer'
      },
      {
        path: '/home/mvdetail/:id',
        component: MvDetail,
        name: 'mvdetail'
      },
      {
        path: '/home/detail/:id',
        name: 'detail',
        component: SongDetail
      },
      {
        path: '/home/singerLeaderBoard',
        name: 'singerleader',
        component: SingerLeader
      },
      {
        path: '/home/singerDetail',
        name: 'singerDetail',
        component: SingerDetail
      },
      {
        path: '/home/searchIndex/:content',
        name: 'searchIndex',
        component: SearchIndex
      }
    ]
  },
  {
    path: '/login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
